Conversation
|
@apavlo Joy wrote the original code and nobody has touched that code in a long time. I don't know if anybody else understands it so can you take a look? |
|
@tli2 Sure, I will rebase locally, and fix all tabs. |
db-ol
left a comment
There was a problem hiding this comment.
Remove redundant calls and unused variables. Revise incorrect comments. And some possible testing improvements.
|
|
||
| // Insert column info into each catalog | ||
| oid_t column_id = 0; | ||
| std::vector<oid_t> pkey_attrs, unique_attrs; |
| // Insert column info into each catalog | ||
| oid_t column_id = 0; | ||
| std::vector<oid_t> pkey_attrs, unique_attrs; | ||
| std::shared_ptr<Constraint> pkey_constraint, unique_constraint; |
There was a problem hiding this comment.
The variables are also unused.
| ->GetSchema(); | ||
|
|
||
| // Create index | ||
| std::stringstream index_name(table_object->GetTableName().c_str()); |
| src_table_oid, txn); | ||
| auto src_schema = src_table->GetSchema(); | ||
|
|
||
| std::stringstream index_name(src_table_object->GetTableName().c_str()); |
|
|
||
| /*@brief Insert a constraint into the pg_constraint table | ||
| * This targets PRIMARY KEY, FOREIGN KEY, UNIQUE or CHECK constraint | ||
| * @param table_oid oid of the table related to this constraint |
There was a problem hiding this comment.
table_oid is not in the parameters.
There was a problem hiding this comment.
Delete redundant comments.
| auto salary = catalog->GetTableObject("emp_db", DEFAULT_SCHEMA_NAME, | ||
| "salary_table", txn); | ||
|
|
||
| catalog->AddPrimaryKeyConstraint(emp->GetDatabaseOid(), emp->GetTableOid(), |
There was a problem hiding this comment.
Why add PrimaryKey constraints in the CreatingTable test and without verifying it?
There was a problem hiding this comment.
These are not adding, but just fixing. These might be used in other test? Verifying for primary keys is done in ConstraintCatalogTest.
|
|
||
| catalog->AddPrimaryKeyConstraint(emp->GetDatabaseOid(), emp->GetTableOid(), | ||
| {0}, "con_primary", txn); | ||
| catalog->AddPrimaryKeyConstraint(department->GetDatabaseOid(), |
There was a problem hiding this comment.
Why add PrimaryKey constraints in the CreatingTable test and without verifying it?
| catalog->AddPrimaryKeyConstraint(department->GetDatabaseOid(), | ||
| department->GetTableOid(), {0}, | ||
| "con_primary", txn); | ||
| catalog->AddPrimaryKeyConstraint( |
There was a problem hiding this comment.
Why add PrimaryKey constraints in the CreatingTable test and without verifying it?
| LOG_DEBUG("%s", con_table->GetSchema()->GetInfo().c_str()); | ||
| LOG_DEBUG("Complete check for constraint table"); | ||
|
|
||
| // Drop constraint |
There was a problem hiding this comment.
Would it be better if we can verify it after dropping constraints?
There was a problem hiding this comment.
Correct. Add verifying.
| table->AddIndex(pkey_index); | ||
|
|
||
| // Create primary key constraint on the table | ||
| if (need_primary_index) { |
There was a problem hiding this comment.
Should it be need_primary_index or need_primary_key?
There was a problem hiding this comment.
Fix it to need_primary_key.
* Add pg_constraint catalog table * Reconstruct constraints
* Revert "Constraint refactoring (cmu-db#1415)" This reverts commit 898219f
This PR refactors constraint stuff related to planner, executor, storage and catalog.
- Contributions
pg_constraintTable constraint (Primary key, Foreign key, Unique, Check) ->
Constraint(pg_constraint)Column constraint (Not null, Default) ->
Column(pg_attribute)Deleted class ->
ForeignKey,MultiConstraintCatalog.DataTablewhen inserting/updating.- Related Issues
- Remaining Issues